package com.project.user.entity.entitly;

import com.untils.StaticMessage;

import java.util.Date;

public class UserPhoneCode {
    private Integer id;

    private String phoneNumber;

    private String phoneCode;

    private Date phoneStarttime;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber == null ? null : phoneNumber.trim();
    }

    public String getPhoneCode() {
        return phoneCode;
    }

    public void setPhoneCode(String phoneCode) {
        this.phoneCode = phoneCode == null ? null : phoneCode.trim();
    }

    public Date getPhoneStarttime() {
        return phoneStarttime;
    }

    public void setPhoneStarttime(Date phoneStarttime) {
        this.phoneStarttime = phoneStarttime;
    }

    public UserPhoneCode() {
    }

    public UserPhoneCode(String phone) {
        UserPhoneCode userCode = new UserPhoneCode();
        userCode.setPhoneCode(String.valueOf((int)(Math.random()*9000+1000)));
        userCode.setPhoneNumber(phone);
        userCode.setPhoneStarttime(new Date(System.currentTimeMillis()+ StaticMessage.PHONE_CODE_TIMEOUT*1000*60));
    }
}
